<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<s:url value="/css/style.css"/>" rel="stylesheet" type="text/css" />
<link href="<s:url value="/css/jquery.css"/>" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<s:url value="/js/jquery.js"/>"></script>
<script type="text/javascript" src="<s:url value="/js/common.js"/>"></script>
<script type="text/javascript" src="<s:url value="/js/jquery-ui.js"/>"></script>
<script type="text/javascript" src="<s:url value="/js/jquery.form.js"/>"></script>
<script type="text/javascript" src="<s:url value="/js/jquery.validate.js"/>"></script>
<script type="text/javascript">
var oldLoginName = '<s:property  value="loginName" />';
function doSubmit(){
	if(window.confirm('Save modify?')) {
		var isSame = isSameAsExsited($('#loginName').val(),'<s:url value="/system/User/same" />');
		 
		if(!isSame||oldLoginName==$('#loginName').val()){
		$('#editForm').submit();
		}else {
			var str = 'Please fix this field.';
			$('#xxx').html(str).addClass('error').show(); 
			 
		}
	}
}
function goBack(){
	location.href='<s:url value="/system/User/list"/>';
}
$(function(){
	
	$('#editForm').validate();
	if($.trim($('#result').text())!=''){
		popupDiv('pop-div');
	}
	$('#birthday').datepicker({dateFormat:'yy-mm-dd'});
});

</script>
<title><s:text name="system.title" /></title>
</head>
<body>
<s:include value="/common/up.jsp"></s:include>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td class="box">
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td id="tag-over"><span id="tag-over">User </span></td>
				<td class="tab3-line" width="90%">&nbsp;</td>
			</tr>
		</table>
		<s:form  action="User/save2" namespace="/system" method="post" id="editForm" name="editForm">
		<s:hidden name="id"></s:hidden>
		<table width="100%" border="0" cellpadding="3" cellspacing="1" class="margin">
			<tr>
				<td align="right" width="50%" class="tablecolour5">User Name<font color="red">*</font>:</td>
				<td width="50%" class="tablecolour5"><s:textfield name="name" cssClass="input2 required" size="24" disabled="true" /></td>
			</tr>
			<tr>
				<td align="right" width="50%" class="tablecolour5">Login Name<font color="red">*</font>:</td>
				<td width="50%" class="tablecolour5"><s:textfield name="loginName" id="loginName" cssClass="input2 required" size="24" disabled="true" /><label id="xxx"></label></td>
			</tr>
			<tr>
				<td align="right" width="50%" class="tablecolour5">Password<font color="red">*</font>:</td>
				<td width="50%" class="tablecolour5"><s:textfield  name="password" cssClass="input2 required" size="24" /></td>
			</tr>
			<tr>
				<td align="right" width="50%" class="tablecolour5">WorkCode<font color="red">*</font>:</td>
				<td width="50%" class="tablecolour5"><s:textfield name="workcode" cssClass="input2 required" size="24" /></td>
			</tr>
			<tr>
				<td align="right" width="50%" class="tablecolour5">Caller Number</td>
				<td width="50%" class="tablecolour5"><s:textfield name="telCode" cssClass="input2" size="24" /></td>
			</tr>
			<tr>
				<td align="right" width="50%" class="tablecolour5">Telephone<font color="red">*</font>:</td>
				<td width="50%" class="tablecolour5"><s:textfield name="telephone" cssClass="input2 required" size="24" /></td>
			</tr>
			<tr>
				<td align="right" width="50%" class="tablecolour5">E-mail:</td>
				<td width="50%" class="tablecolour5"><s:textfield name="email" cssClass="input2" size="24" /></td>
			</tr>
			<tr>
				<td align="right" width="50%" class="tablecolour5">Address:</td>
				<td width="50%" class="tablecolour5"><s:textfield name="address" cssClass="input2" size="24" /></td>
			</tr>
			<tr>
				<td align="right" class="tablecolour5">Birthday:</td>
				<td class="tablecolour5"><s:date name="birthday" format="yyyy-MM-dd" var="birthdayFmt"/><s:textfield name="birthday" id="birthday" cssClass="input2" size="24" value="%{birthdayFmt}" /></td>
			</tr>
			 	<tr>
				<td align="right" width="50%" class="tablecolour5">Sex:</td>
				<td width="50%" class="tablecolour5"><s:select name="sex" listKey="name()" list="@com.ef.constant.EGenderType@values()" /></td>
			</tr>
			
			<tr style="display:none;">
				<td align="right" width="50%" class="tablecolour5">School:</td>
				<td width="50%" class="tablecolour5"><s:select name="school.id"  list="schoolList" /></td>
			</tr>
			<tr style="display:none;">
				<td align="right" width="50%" class="tablecolour5">Department:</td>
				<td width="50%" class="tablecolour5"><s:select  name="department.id" list="departmentList" headerKey=""/></td>
			</tr>
			<tr style="display:none;">
				<td align="right" width="50%" class="tablecolour5">Team:</td>
				<td width="50%" class="tablecolour5"><s:select name="team.id"  list="teamList" headerKey=""/></td>
			</tr>
			<tr style="display:none;">
				<td align="right" width="50%" class="tablecolour5" >Role:</td>
				<td width="50%" class="tablecolour5"><s:select name="role.id"  list="roleList" headerKey=""/></td>
			</tr>
		<tr>
			<td align="center" colspan="2" height="50" class="tablecolour5">
			<input type="button" class="btn1" value="Save"  onclick="doSubmit();"  /> 
			</td>
		</tr>
		</table>
		</s:form>
		</td>
	</tr>
</table>
<s:include value="/common/down.jsp"></s:include>
<div id='pop-div' style="width: 300px;" class="pop-box">  
  <s:include value="/common/confirm.jsp"></s:include>   
</div>

</body>
</html>